package Weapons;

import org.newdawn.slick.geom.Vector2f;

import game.Config.BulletFactory;
/**
 * This class represents a flamethrower. The flamethrower
 * extends the Machinegun class and thus fire bullets with a given spread.
 * The bullets spawned however will only travel a given distance
 * and will burn targets when hit.
 * @author Sebastian Isheden and Victor Beer.
 */
public class Flamethrower extends MachineGun{
	private float fadeDistance;
	private float burnDamage;
	private float burnDuration;
	/**
	 * Creates a flamethrower with given parameters. 
	 * @param fireRate	The amount of times this weapon can fire per second.
	 * @param damage  The damage per shot of this weapon.
	 * @param bulletSpeed  The speed the fired bullets will traverse the screen.
	 * @param recoil The degree that the bullets will be spread.
	 * @param fadeDistance The distance that the bullets will travel before disappearing.
	 * @param burnDuration The time that the bullet fired will burn a target.
	 * @param burnDamage The damage per second that the fire will hurt it's target. 
	 */
	public Flamethrower(float fireRate, float damage, float bulletSpeed, double recoil,float fadeDistance,float burnDuration,float burnDamage) {
		super(fireRate, damage, bulletSpeed, recoil);
		this.fadeDistance = fadeDistance;
		this.burnDamage = burnDamage;
		this.burnDuration = burnDuration;
	}
	/**
	 * Returns a copy of the flamethrower.
	 */
	@Override
	public Flamethrower copy(){
		return new Flamethrower(1/this.fireInterval,this.damage,this.bulletSpeed,this.recoil,this.fadeDistance,this.burnDuration,this.burnDamage);
	}
	@Override
	protected void callFactory(Vector2f position,Vector2f direction){
		BulletFactory.createFireBullet(this.damage,this.bulletSpeed,position,direction,this.fadeDistance,this.burnDuration,this.burnDamage);
	}

}
